package com.itheima;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class rabbitMqConfig {
    //声明队列
    @Bean
    public Queue directQueue(){

        return  new Queue("direct_queue",true);
    }
    //声明交换机
    @Bean
    public Exchange directExchange(){

        return  new DirectExchange("direct_exchange_ex");
    }
    //绑定队列和路由
    @Bean
    public Binding binding(){
        return BindingBuilder
                .bind(directQueue())
                .to(directExchange())
                .with("direct")
                .noargs();
    }

}
